namespace SmallMvc
{
    public class ViewKey
    {
        public string ControllerName { get; set; }
        public string ControllerAction { get; set; }

        public ViewKey(string controllerName, string controllerAction)
        {
            ControllerName = controllerName;
            ControllerAction = controllerAction;
        }

        public bool Equals(ViewKey other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.ControllerName, ControllerName) && Equals(other.ControllerAction, ControllerAction);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (ViewKey)) return false;
            return Equals((ViewKey) obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return ((ControllerName != null ? ControllerName.GetHashCode() : 0)*397) ^ (ControllerAction != null ? ControllerAction.GetHashCode() : 0);
            }
        }
    }
}